﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Authors_AuthorInsert : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }


    //This method will redirect back to Author list page
    //You need to go to AuthorInsert.aspx source code 
    //And add OnItemInserted="DetaiView_ItemInsert" to asp tag of DetailView
    //After the DefaultMode="Insert"
    protected void DetaiView_ItemInsert(object sender, DetailsViewInsertedEventArgs e)
    { 
        if(e.AffectedRows == 1)
        {
            Response.Redirect("~/Authors/Authors.aspx");
        }
    }


    //This method will redirect back to Author list page
    //You need to go to AuthorInsert.aspx source code 
    //And add OnItemCommand="DetaiView_ItemCommand" to asp tag of DetailView
    //After the DefaultMode="Insert"
    protected void DetailView_ItemCommand(object sender, DetailsViewCommandEventArgs e)
    { 
        if(e.CommandName == "Cancel")
        {
            Response.Redirect("~/Authors/Authors.aspx");
        }
    }
}